home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17789 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  72 lines

  1. Path: news.uh.edu!bti!usenet
  2. From: "Sean C. Olson" <olson@rose.rsoc.rockwell.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Circular Usage (forward declaration?)
  5. Date: Wed, 17 Apr 1996 09:54:04 -0500
  6. Organization: Rockwell Space Operations
  7. Message-ID: <3175060C.6EA0@rose.rsoc.rockwell.com>
  8. References: <MRW.96Apr16184800@tobago.siemens.ch>
  9.         <ltu3ykovzc.fsf@kitz.inferenzsysteme.informatik.th-darmstadt.de>
  10.         <31747631.5970@datalytics.com> <MRW.96Apr17104121@tobago.siemens.ch> <MRW.96Apr17105737@tobago.siemens.ch>
  11. NNTP-Posting-Host: rose.rsoc.rockwell.com
  12. Mime-Version: 1.0
  13. Content-Type: text/plain; charset=us-ascii
  14. Content-Transfer-Encoding: 7bit
  15. X-Mailer: Mozilla 2.01 (X11; I; SunOS 5.4 sun4m)
  16.  
  17. Waeckerlin Marc wrote:
  18. > Hi there
  19. > You have the same problem in other cases (yes I know there is an endless loop):
  20. > class B;
  21. > class A
  22. > {
  23. >   public:
  24. >     void b(B &x)
  25. >     {
  26. >       x.a(*this);
  27. >     }
  28. > };
  29. > class B
  30. > {
  31. >   public:
  32. >     void a(A &x)
  33. >     {
  34. >       x.b(*this);
  35. >     }
  36. > };
  37.  
  38. This will work, but it is no longer "inlinable".
  39.  
  40. class B;
  41.  
  42. class A
  43. {
  44.   public:
  45.     void b(B &x);
  46. };
  47.  
  48. class B
  49. {
  50.   public:
  51.     void a(A &x);
  52. };
  53.  
  54. void A::b (B &x) {
  55.   x.a (*this);
  56. }
  57.  
  58. void B::a (A &x) {
  59.   x.b (*this);
  60. }
  61.  
  62. -- 
  63. Sean Olson               (713) 282-3740
  64. Unisys Space Systems     olson@rose.rsoc.rockwell.com
  65. RSOC
  66.